#pragma once
#include <string>
#include <map>
#include "TinyCC_Define.h"
#include "TinyDBMapper.h"
#include "TinyDBLayer/TinyDBInterface.h"
#include "TinyDBLayer/TinyDBMysqlInterface.h"
#include "TinyMsg.h"

using namespace TinyCC::msg;

class CTinyDBManager
{
public:
	CTinyDBManager(void);
	~CTinyDBManager(void);
	
	bool openMysqlDBConnection(std::string connStr);
	void setDBInterface(CTinyDBInterface* DBif){if(DBif!=NULL)m_DBInterface = DBif;};
	//bool loadDataFromDB();
protected:

	CTinyDBInterface* m_DBInterface;
	//std::map<int,CTinyDBMapper*> m_Mappers;
	std::string m_connStr;
	int m_dbtype;

public:
	//void pushMapper(int key, CTinyDBMapper<T>* mapper);
	virtual void init(int dbtype, std::string & connstr);
	//CTinyDBMapper* findMapper(int key);
	virtual bool ProcessReceivedMsg(CTinyMsg& inMsg, CTinyMsg& outMsg) = 0;
};
